Home:ALL Converter>MySQL query for searching by address when the address is split over multiple fields

MySQL query for searching by address when the address is split over multiple fields

Ask Time:2022-09-22T16:40:24         Author:Michael LB

Json Formatter

I have slimmed things down for example purposes.

I have three MySQL database fields in a table called "property";

property_house_number
property_street_name
property_postcode

I have a page that allows the client to search for a property by address. This page has three input fields that correspond to the MySQL database fields;

Property House Number:
Property Street Name:
Property Postcode:

At the moment, if my client wanted to search for the address "1 Church Road, L15", he would enter the following into the input fields;

Property Number: 1
Property Street Name: Church Road
Property Postcode: L15

My client wants there to be just one input field where he can simply enter "1 Church Road L15". The client may also just want to search using one part of the address, e.g. just "Church Road" or just "L15".

Is there a MySQL query that allows for this?

Author:Michael LB,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/73811698/mysql-query-for-searching-by-address-when-the-address-is-split-over-multiple-fie
yy